From 0f38aee374029213a47ef7c29bd164093fe63c85 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 15 Nov 2023 12:24:42 +0100
Subject: refactor(hooks): remove useSettings hook

It does not make sense to re-export an existing object through a hook.
On some pages both the hook and the object was imported...
It is better to use the CONFIG (previously settings) object directly
and by doing it we avoid potential errors because of conditional hooks.
---
 src/pages/projets/[slug].tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/pages/projets/[slug].tsx')

diff --git a/src/pages/projets/[slug].tsx b/src/pages/projets/[slug].tsx
index fa8f43a..1aa9e7f 100644
--- a/src/pages/projets/[slug].tsx
+++ b/src/pages/projets/[slug].tsx
@@ -28,6 +28,7 @@ import {
 } from '../../components';
 import styles from '../../styles/pages/project.module.scss';
 import type { NextPageWithLayout, ProjectPreview, Repos } from '../../types';
+import { CONFIG } from '../../utils/config';
 import { ROUTES } from '../../utils/constants';
 import {
   getSchemaJson,
@@ -40,7 +41,7 @@ import {
   loadTranslation,
   type Messages,
 } from '../../utils/helpers/server';
-import { useBreadcrumb, useGithubApi, useSettings } from '../../utils/hooks';
+import { useBreadcrumb, useGithubApi } from '../../utils/hooks';
 
 const BorderedImage = (props: NextImageProps) => (
   <Figure hasBorders>
@@ -170,11 +171,10 @@ const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => {
     }
   );
 
-  const { website } = useSettings();
   const { asPath } = useRouter();
   const page = {
-    title: `${seo.title} - ${website.name}`,
-    url: `${website.url}${asPath}`,
+    title: `${seo.title} - ${CONFIG.name}`,
+    url: `${CONFIG.url}${asPath}`,
   };
 
   const headerMeta: (MetaItemData | undefined)[] = [
@@ -273,7 +273,7 @@ const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => {
 
   const webpageSchema = getWebPageSchema({
     description: seo.description,
-    locale: website.locales.default,
+    locale: CONFIG.locales.defaultLocale,
     slug: asPath,
     title: seo.title,
     updateDate: dates.update,
@@ -284,7 +284,7 @@ const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => {
     description: intro,
     id: 'project',
     kind: 'page',
-    locale: website.locales.default,
+    locale: CONFIG.locales.defaultLocale,
     slug: asPath,
     title,
   });
-- 
cgit v1.2.3

